# Makefile for iTextUploader
# Revision: $Id$

CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc
LD = $(CC)

Options = -arch armv6 \
	-march=armv6 \
	-gdwarf-2 \
	-std=c99 \
	-O3 \
	-mcpu=arm1176jzf-s \
	-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk \
	-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Library/PrivateFrameworks\
	-bind_at_load \
	-multiply_defined suppress \
	-mthumb

LinkerOptions = -lobjc \
	-lcrypto \
	-lsqlite3 \
	-lz \
	-framework CoreFoundation \
	-framework Foundation \
	-framework UIKit \
	-framework CoreGraphics \
	-framework CFNetwork \
	-framework AppSupport \
	-framework AddressBook

all:	iTextUploader

iTextUploader: main.o iTextUploaderAppDelegate.o MainView.o HomeView.o PreferencesData.o PreferencesView.o UploadView.o BrowseView.o AlertBox.o ExportedView.o TextAlertView.o ITUImport.o ASIFormDataRequest.o ASIHTTPRequest.o ASINetworkQueue.o NSHTTPCookieAdditions.o SBJSON.o NSData+GzipData.o
	$(LD) $(Options) $(LinkerOptions) -o $@ $^
	export CODESIGN_ALLOCATE="/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"; ldid -S iTextUploader
	-mkdir iTextUploader.app/
	cp -p iTextUploader ./iTextUploader.app/
	cp -p Info.plist ./iTextUploader.app/
	cp -p icon.png ./iTextUploader.app/
	cp -p Preferences.png ./iTextUploader.app/
	cp -p Home.png ./iTextUploader.app/
	cp -p Upload.png ./iTextUploader.app/
	cp -p Browse.png ./iTextUploader.app/
	cp -p Exported.png ./iTextUploader.app/
	cp -p Paypal.gif ./iTextUploader.app/
	cp -p Help.png ./iTextUploader.app/
	cp -p loading_bg.png ./iTextUploader.app/
	cp -p ConnectionError.html ./iTextUploader.app/
	cp -p UploadViewMainText.html ./iTextUploader.app/
	cp -p AboutText.html ./iTextUploader.app/
	cp -p ExportedViewNoFilesText.html ./iTextUploader.app/
	cp -p ExportedViewWithFilesText.html ./iTextUploader.app/

clean:
	rm -vf *.o *.gch iTextUploader
	rm -rv iTextUploader.app

%.o:       %.m
	$(CC) -c $(Options) $< -o $@

%.o:       %.c
	$(CC) -c $(Options) $< -o $@

%.o:       %.cpp
	$(CC) -c $(Options) $< -o $@
